package com.Lyoto.NetNotify.Handler.impl;

import cn.hutool.http.ContentType;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.Lyoto.NetNotify.Constraint.NetConfig;
import com.Lyoto.NetNotify.Handler.PushRegistrar;
import lombok.extern.slf4j.Slf4j;

/***
 @author Lyoto
 @description ifttt 发送邮件webhook收费
 @create 12/3/2023-下午6:15
 ***/
@Slf4j
@Deprecated
public class Ifttt4EmailPusher implements PushRegistrar {
    public Ifttt4EmailPusher() {
        log.info("推送启动加载项|正在配置IFTTT推送……");
    }

    @Override
    public void pushOn() {
        String ip = JSONUtil.createObj().set("ip", NetConfig.getIp()).toJSONString(0);
        HttpUtil.createPost("https://maker.ifttt.com/trigger/net_address_notify/json/with/key/cp6NSH9WGPVqMQs5Vkf8Ak").body(ip, ContentType.JSON.getValue()).execute();
        log.info("已通过ifttt推送消息至邮箱=>{}",ip);
    }
}
